package org.example;

import lombok.extern.slf4j.Slf4j;
import org.example.controller.UserController;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

/**
 * @Author : zhangbo
 * @data : 2024/7/12
 * @description :
 */

/**
 * 如果没有使用注解排除包扫描，spring默认扫描当前类所在包及其子包
 *
 * 使用内嵌tomcat启动web服务，使得我们可以通过浏览器访问
 */
@SpringBootApplication
@MapperScan("org.example.mapper")
@Slf4j
public class AmqpApplication {
    public static void main(String[] args) {
        /**
         * spring管理的bean，启动了一个容器，加载了我们定义的bean
         */
        ConfigurableApplicationContext context = SpringApplication.run(AmqpApplication.class);
        ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
        UserController bean = context.getBean(UserController.class);
        log.info("AmqpApplication启动成！");
    }
}
